<?php

namespace app\storeapi\controller;

use app\storeapi\model\User as UserModel;

/**
 * 登录
 * Class User
 * @package app\api
 */
class Oauth extends Controller
{

    /**
     * 用户自动登录
     * @return array
     * @throws \app\common\exception\BaseException
     * @throws \think\Exception
     * @throws \think\exception\DbException
     */
    public function login()
    {

        $model = new UserModel;
        //登录逻辑
        $data = $model->login($this->postData());
        return $this->renderSuccess($data,'成功');
    }
    /*
     * 授权获取手机号码
     */
    public function getMobile(){
        $model = new UserModel;
        $data = $model->updateData($this->postData());
        if($data['code']=='success'){
            return $this->renderSuccess($data,'成功');
        }
        return $this->renderError($data,'失败');
    }

}
